//
//  JHSpcialTableViewCell.m
//  Liberty Voice
//
//  Created by dlios on 15-5-14.
//  Copyright (c) 2015年 ClearLove. All rights reserved.
//

#import "JHSpcialTableViewCell.h"
#import "UIImageView+WebCache.h"

@interface JHSpcialTableViewCell ()
@property(nonatomic,retain)UIImageView *image;
@property(nonatomic,retain)UIView *baseView;
@property(nonatomic,retain)UILabel *splable;
@end

@implementation JHSpcialTableViewCell

- (void)dealloc
{
    [_image release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.image = [[[UIImageView alloc] init] autorelease];
        [self.contentView addSubview:_image];
        
        self.baseView = [[[UIView alloc] init] autorelease];
        _baseView.backgroundColor = [UIColor grayColor];
        _baseView.alpha = 0.7;
        [_image addSubview:_baseView];
        
        self.splable = [[[UILabel alloc] init] autorelease];
//        _splable.alpha = 1;
        _splable.textAlignment = 1;
        [_baseView addSubview:_splable];
    }return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _image.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height - 20);
    _baseView.frame = CGRectMake(0,( _image.frame.size.height / 5) * 4, _image.frame.size.width, _image.frame.size.height /5);
    _splable.frame = CGRectMake(0, 5, _baseView.frame.size.width, _baseView.frame.size.height - 10);
}
- (void)setSpecial:(JHSpecial *)special
{
    if (special != _special) {
        [_special release];
        _special = [special retain];
    }
    [_image sd_setImageWithURL:[NSURL URLWithString:special.coverPathBig]];
    _splable.text = special.title;
    
}
- (void)awakeFromNib {
    // Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
